#pragma once
#include <string>
#include <cstddef>
#include <odb/nullable.hxx>
#include <odb/core.hxx>


namespace xu
{
    #pragma db object
    class Session
    {
    friend class odb::access;
    public:
        Session(const std::string & session_id, const std::string & user_id)
        :_session_id(session_id),
         _user_id(user_id)
        {}
        Session(){}

        void session_id(const std::string & session_id){ _session_id = session_id;}
        std::string session_id(){return _session_id;}

        void user_id(const std::string & user_id){ _user_id = user_id;}
        std::string user_id(){return _user_id;}


    private:
        #pragma db id auto // 表示 ID 字段将自动生成（通常是数据库中的主键）。
        unsigned long _id;

        #pragma db index type("VARCHAR(63)") 
        std::string _session_id;       //会话id

        #pragma db type("VARCHAR(63)")
        std::string _user_id;       //用户id

    };
}